/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UI;

import BO.Controller;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author Wase
 */
@ManagedBean
@RequestScoped
public class RegisterBean {

    private int Id; // ID this is
    private String username;
    private String password;
    private String confirmPassword;
    private String firstName;
    private String surName;
    private String address;
    private String zipcode;
    private String city;
    private String country;
    private String email;
    Controller controller;
    
    
    /** Creates a new instance of RegisterBean */
    public RegisterBean() {
        controller = new Controller();
    }

    public int getId() {
        return Id;
    }

    public void setId(int Id) {
        this.Id = Id;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSurName() {
        return surName;
    }

    public void setSurName(String surName) {
        this.surName = surName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }
    
    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getConfirmPassword() {
        return confirmPassword;
    }

    public void setConfirmPassword(String confirmPassword) {
        this.confirmPassword = confirmPassword;
    }
    
    public String register(String username, String password, String confirmPassword,
                            String firstName, String surName, String address,
                            String zipcode, String city, String country, String email) {
        if (password.compareTo(confirmPassword) == 0) {
            String regged = controller.register(username, password, firstName, surName, address, zipcode, city, country, email);
            if (regged.equals("registered")) {
                return "registered";
            }
        }
        return "notRegistered";
    }
    
}
